import React, { Component } from 'react';
import Header from '../../../components/Header/ShareHeader';
import { connect } from "react-redux";
import { Toast } from 'react-weui';
import * as actions from '../../../store/action/ambitus';
import '../../../static/css/common.less';
import Utils  from '../../../utils';
import './activity.less';

class Activity extends Component {
    componentWillMount(){
        this.id = this.props.match.params.id;
        this.props.fetchAmbitusDetail(this.id);
    }
    openApp = () =>{
        window.location.href = 'http://huiyouduoapp.com/';
    }
    render() {
        return (
            <div>
                <div className="detail-region">
                    <Header title="活动详情"></Header>
                    <section class="content act-content">
                    {this.props.ambitus.detail.activities.length>0?
                        <div className="content-region">
                            <div className="title">{this.props.ambitus.detail.activities[0].title}</div>
                            <div className="date">{this.props.ambitus.detail.activities[0].created_at}</div>
                            <div className="img"><img src={this.props.ambitus.detail.activities[0].cover}></img></div>
                            <div className="contentBox"></div>
                        </div>
                    :<div className="content-region"></div>}
                     <button className="wechat-share-btn" onClick={this.openApp}>打开App<i></i></button>
                    </section>
                </div>
            </div>
        )
    }
}

export default connect((state)=>{return {...state}}, actions)(Activity);